<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>订单管理 - 发货</title>
<?php include $this->c['_homes']['_viewsHome'] . '/_global/_head.php';?>
<link rel="stylesheet" type="text/css" href="/style/assets/plugins/bootstrap-datetimepicker/css/datetimepicker.css" />
<link href="/style/assets/css/summernote.css" rel="stylesheet">
<link href="/style/assets/css/summernote-bs3.css" rel="stylesheet">
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include $this->c['_homes']['_viewsHome'] . '/_global/head.php';?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" >
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include $this->c['_homes']['_viewsHome'] . '/_global/menu.php';?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR -->
  <!-- BEGIN PAGE -->
  <div class="page-content">
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 发货 </h3>
        <ul class="page-breadcrumb breadcrumb">
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 订单管理 <i class="icon-angle-right"></i> </li>
          <li> <a href="/order/olist">订单列表</a> <i class="icon-angle-right"></i> </li>
           <li> <a href="/order/detail?order_id=<?=$this->data['order_id']?>">查看订单</a> <i class="icon-angle-right"></i> </li>
          <li>发货</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
      </div>
    </div>
    <!-- END PAGE HEADER-->
    <!-- BEGIN PAGE CONTENT-->

<div class="row">
      <div class="col-md-9">
        <!-- BEGIN SAMPLE FORM PORTLET-->
        <div class="portlet box blue">
          <div class="portlet-title">
            <div class="caption"> <i class="icon-reorder"></i> 发货 </div>
            <div class="tools"> <a href="" class="collapse"></a> </div>
          </div>
          <div class="portlet-body form">
            <form  class="form-horizontal" id="forms">
              <input type="hidden" name="act" value="edit" />
              <input type="hidden" name="order_id" value="<?=$this->data['order_id'];?>">
              <input type="hidden" name="rec_id"  value="<?=$this->data['rec_id'];?>" />
              <div class="form-body">
             <div class="form-group">
                         <label  class="col-md-3 control-label">快递名称<span class="required">*</span></label>
                        <div class="col-md-6">
                          <select name="shipping_name" id="_shipping_name" class="form-control">
                            <option value="">请选择快递名称</option>
                            <?php
if ($this->exlist) {
    foreach ($this->exlist as $r) {
        if ($this->data['shipping_name'] == $r['company_name']) {
            $slk = ' selected';
        } else {
            $slk = '';
        }

        ?>
                            <option value="<?=$r['company_name'];?>" data-id="<?=$r['id'];?>"<?=$slk;?>><?=$r['company_name'];?></option>
                            <?
    }
}
?>
                          </select>
                       </div>
                     </div>
                <div class="form-group">
                  <label class="col-md-3 control-label">快递单号<span class="required">*</span></label>
                  <div class="col-md-6">
                    <input name=shipping_id  class="form-control" value="<?=$this->data['shipping_id'];?>" id="_shipping_id" type="text" placeholder="请输入快递号码">

                  </div>
                </div>

              </div>
              <div class="form-actions fluid">
                <div class="col-md-offset-3 col-md-9">
                  <button type="button" class="btn blue" onclick="sub()">提交</button>
                  <button type="button" class="btn default" onClick="history.back(1);">取消</button>
                </div>
              </div>
            </form>
          </div>
        </div>
        <!-- END SAMPLE FORM PORTLET-->

      </div>
    </div>
    <!-- END PAGE CONTENT-->
  </div>
  <!-- END PAGE -->
</div>
<!-- END CONTAINER -->
<?php include $this->c['_homes']['_viewsHome'] . '/_global/_footer.php';?>


<script>
jQuery(document).ready(function() {
   App.init();
});
function sub(){


  if($('#_shipping_name').val() == ''){
    swal("快递名称不能为空");
    return false;
  }
  if($('#_shipping_id').val() == ''){
    swal("快递单号不能为空");
    return false;
  }

//dataType:'json',
  $.ajax({type:'POST',url:"shipping_edit",dataType:'json',data:$('#forms').serialize(), success: function(json) {
      console.log(json);
      if(json.code==200){
         swal(json.msg,false,"success");
           setTimeout(function(){
               location.href="/order/detail?order_id="+json.order_id;
              },1000);
      }else{
        swal(json.msg,false,"error");
      }
    }
  });

}
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>